473,419 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Decimal comma/point standard?

Hello people,

I thought I was fairly proficient in websearching, but I haven't found
a standard on how to
encode numerical values in an XML file in a standard way. XML docs do
specify character set encoding, but not a locale. So if I generate a
data file, should I use decimal commas or points?

Should I encode the locale in the document to ensure correct reading
of the values? Is there
some standard way to do this?

This probably doesn't belong to the XML issue in itself, but I suspect
this to be a fairly
popular problem.

Sorry if this is some FAQ - I haven't found it...

John
Jun 27 '08 #1
7 6475
On Jun 5, 1:03*pm, JohnC <john.copp...@gmail.comwrote:
Hello people,

I thought I was fairly proficient in websearching, but I haven't found
a standard on how to
encode numerical values in an XML file in a standard way. XML docs do
specify character set encoding, but not a locale. So if I generate a
data file, should I use decimal commas or points?
Should I encode the locale in the document to ensure correct reading
of the values? Is there
some standard way to do this?
You want to use <number-grouping-separatorand <decimal-separator>.

--
Ron
Jun 27 '08 #2
If you're using XML Schema to define your document's format, it has a
standard for this.
Jun 27 '08 #3
On Jun 5, 6:35 pm, Ron Peterson <r...@shell.core.comwrote:
On Jun 5, 1:03 pm, JohnC <john.copp...@gmail.comwrote:
Hello people,
I thought I was fairly proficient in websearching, but I haven't found
a standard on how to
encode numerical values in an XML file in a standard way. XML docs do
specify character set encoding, but not a locale. So if I generate a
data file, should I use decimal commas or points?
Should I encode the locale in the document to ensure correct reading
of the values? Is there
some standard way to do this?

You want to use <number-grouping-separatorand <decimal-separator>.
Hi Rob, Thanks for the hint. I did a search for both names, and found
_very_ few references.
Is this really a standard, or was this specified by Oracle (the first
references I found
pointed there)? Is there any document on this?

Thanks again.
John
Jun 27 '08 #4
On Jun 5, 7:24 pm, "Joseph J. Kesselman" <keshlam-nos...@comcast.net>
wrote:
If you're using XML Schema to define your document's format, it has a
standard for this.
Hi Joseph.
Thanks for the reply. As far as I can see in the W3C Schema
definition, things are simple -
decimal numbers use decimal points, and no option seems to be present
for allowing
decimal commas. ( at least the regular expression in the w3c docs is
definite about that).
It _is_ the simplest solution.

John
Jun 27 '08 #5
Thanks for the reply. As far as I can see in the W3C Schema
definition, things are simple -
decimal numbers use decimal points, and no option seems to be present
for allowing
decimal commas. ( at least the regular expression in the w3c docs is
definite about that).
It _is_ the simplest solution.
For data interchange purposes, you want to pick *one* convention. No
matter which one you pick it's going to disappoint someone, so the
question winds up being which one's natural for the folks writing the
spec. And since most spec authors are programmers and most programmers
(and languages) already expect . as the decimal separator... More
directly: There was an existing standard Schema could reference, so they
referenced it rather than reinventing the wheel.

Of course user interfaces are free to render the data in other ways. And
you can use the other convention in XML if you're willing to be
nonstandard or to simply treat it as text rather than expecting other
tools to recognize it as the intended number.

(Someday I should look up how , and . wound up with their functions
being swapped in some cultures, and check which convention is actually
older... just for historical interest.)
Jun 27 '08 #6
On Jun 5, 11:29*pm, JohnC <john.copp...@gmail.comwrote:
On Jun 5, 6:35 pm, Ron Peterson <r...@shell.core.comwrote:
You want to use <number-grouping-separatorand <decimal-separator>.
Hi Rob, Thanks for the hint. I did a search for both names, and found
_very_ few references.
Is this really a standard, or was this specified by Oracle (the first
references I found pointed there)? Is there any document on this?
The Oracle document is where I got that information. I was thinking
that entities would be a good approach but since Oracle has already
proposed a solution using tags, that seemed to have less conflict with
established practices.

I noticed that France uses spaces for number grouping separators
compared to Germany which uses commas. That makes the tagging method
best for document appearance where the W3C Schema omitting the
grouping separators is best for input to software.

--
Ron

Jun 27 '08 #7
Joseph J. Kesselman wrote:
>Thanks for the reply. As far as I can see in the W3C Schema
definition, things are simple -
decimal numbers use decimal points, and no option seems to be present
for allowing
decimal commas. ( at least the regular expression in the w3c docs is
definite about that).
It _is_ the simplest solution.

For data interchange purposes, you want to pick *one* convention. No
matter which one you pick it's going to disappoint someone, so the
question winds up being which one's natural for the folks writing the
spec. And since most spec authors are programmers and most programmers
(and languages) already expect . as the decimal separator... More
directly: There was an existing standard Schema could reference, so they
referenced it rather than reinventing the wheel.

Of course user interfaces are free to render the data in other ways. And
you can use the other convention in XML if you're willing to be
nonstandard or to simply treat it as text rather than expecting other
tools to recognize it as the intended number.

(Someday I should look up how , and . wound up with their functions
being swapped in some cultures, and check which convention is actually
older... just for historical interest.)
There is a good thread about the pros and cons of choosing one format
over others in the TEI discussions at:
http://lists.village.virginia.edu/pi...05/005397.html

Joe is quite right: pick one, but *document* what you picked, so that
those who come after you can understand it.

///Peter
Jun 27 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
3
by: Kim Bundgaard | last post by:
Hi Any suggestion would be fine. I have installed DB2 Connect EE V8.1 (fixpak 4) at two different Windows 2000 Servers, both have the same regional settings. I am connecting to the same DB2...
8
by: Ahmad A. Rahman | last post by:
Hi all, I have a problem constructing a regular expression using .net. I have a string, separated with comma, and I want to group the string together but, I failed to group a numeric character...
6
by: ibiza | last post by:
Hi all, I've binded some data from a DB in a gridview and one of the values is a float. Even if the flot is represented as 4.2 in the DB, it is rendered as 4,2 in the gridview, with a comma....
3
by: Ntl News Group | last post by:
I have a text box that contains the number 1234, I want the value form the text box to display in a second text box so I used: = The problems is that this displays 1234 and I want it to display...
4
by: =?Utf-8?B?cGF0cmlja2RyZA==?= | last post by:
Hi everyone! I'm using greece - greek in my control panel's regional options, and so, my decimal point is the comma (,), while it is the dot (.) for the sql server db, however, I'm facing...
28
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places?...
1
by: Twanne | last post by:
Hi, I've got some code in VBA where I calculate some numbers. Now some of them are large decimal numbers like -6,3216324E03. So in scientific notations. Now I need to add them to a table with an...
1
by: Joza | last post by:
Hi everybody! I have question about setting decimal symbols... In some countries, for example in my country we use comma for decimal symbol, but in in some other countries it is decimal point....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.